package main

import "fmt"

func main() {
	//type Person struct{
	//	name string
	//	age int
	//	email string
	//}
	////1.按照先后顺序
	//var p1 = Person{"武沛齐",18,"asd@123.com"}
	//fmt.Println(p1.name,p1.age,p1.email)//武沛齐 18 asd@123.com
	////2.按照关键字
	//var p2 = Person{name:"武沛齐",age:18,email:"asd@123.com"}
	//fmt.Println(p2.name,p2.age,p2.email)//武沛齐 18 asd@123.com
	//
	////3.先声明再赋值
	//var p3 Person
	//p3.name = "武沛齐"
	//p3.age = 18
	//p3.email = "asd@123.com"
	//fmt.Println(p3.name,p3.age,p3.email)//武沛齐 18 asd@123.com



	// 结构体指针
	type Person struct{
		name string
		age int
	}

	// 初始化结构体
	var p1 = Person{"武沛齐",18}
	fmt.Println(p1.name,p1.age)

	// 初始化结构体指针
	var p2 = &Person{"武沛齐",18}
	fmt.Println(p2.name,p2.age)
}
